home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
(A)TB
/
(A)TBK.ADF
/
Terminal
/
HandShake_ARexx.doc
< prev
next >
Wrap
Text File
|
1991-02-10
|
11KB
|
250 lines
-----------------
/\/\
/ / \
---/ / /\ \-----
\/ \
Hand / Shake Version 2.20a
---\ / /-----
\ / /
\/\/
-----------------
The HandShake/AREXX Interface
-----------------------------
HandShake has an AREXX port as of version 2.20a. This allows other
programs to issue commands to HandShake, as well as providing a
script language for HandShake. To use this feature, you must own a
copy of AREXX which is available from you local dealer or directly
from William Hawes.
HandShake deals with both AREXX commands and AREXX functions. When
HandShake starts up, it will declare itself as an AREXX function
host. Any AREXX macro which contains calls to the HandShake functions
while HandShake is running will send them to HandShake.
In order to send commands to HandShake, it is nesessary to issue an
ADDRESS or SHELL command from the macro of the following form:
ADDRESS 'HANDSHAKE' or
SHELL 'HANDSHAKE'
Note that the word HANDSHAKE must be in upper case. The name of the
HandShake AREXX port is 'HANDSHAKE'. External programs can send
commands or functions directly by sending correctly formatted Rexx
Messages to this port.
Below is a list of the commands which can be sent to HandShake.
NOTE: The case of the command or function name is not important to
HandShake.
COMMANDS
--------
HS_BAUD baud_rate Sets the baud rate. The baud rate parameter
can be any valid Amiga baud rate.
HS_COLOR Causes HandShake to go into color (3 bit
plane) mode. This command will fail if any
windows are open on the HandShake screen.
HS_DATABITS stop_bits Sets the number of data bits. This parameter
must be '7' or '8'.
HS_DELAY seconds Causes macro execution to pause for the
specified number of seconds.
HS_ENDASCII Causes an ASCII receive to finish.
HS_GETLENGTH Sets the number of additional characters that
are returned with the matched part of a
string from the HS_GETSTR command. By default
this is set to zero.
HS_HANGUP Hang up the phone (Disconnect from the other
host).
HS_HIDE Place the HandShake screen behind all other
screens.
HS_MONO Causes HandShake to go into monochrome (2 bit
plane) mode. This command will fail if any
windows are open on the HandShake screen.
HS_PARITY parity Sets the parity. The parameter must be one
of: NONE, ODD, EVEN, SPACE, MARK.
HS_PROTOCOL protocol This command sets the file transfer protocol
for subsequent file transfers. The protocol
must be one of:
ASCII
XMODEM
XMODEM/CRC
YMODEM
YMODEM/BATCH
KERMIT/TEXT
KERMIT/8BIT
KERMIT/7BIT
HS_SHOW Place the HandShake screen in front of all
other screens.
HS_STOPBITS stop_bits Sets the number of stop bits. This parameter
must be '0' or '1' or '2'.
HS_TIMEOUT seconds This sets the timeout value for the GETSTR()
function. If no match is found within the
specified number of seconds. The GETSTR()
function will abort and return the string
HSERR_TIMEOUT.
HS_QUIT This command will cause HandShake to
terminate. It will fail if any windows are
open on the HandShake screen.
Below is a list of the functions which can be sent to HandShake.
NOTE: The returned value 'r' is a boolean value of '0' for failure or
'1' for success unless otherwise noted.
NOTE: When calling AREXX functions, the openning parentheses must
immediately follow the function name with no intervening white space.
r = HS_DIAL(dial_str) This function dials a host system. The
dial_str is a string of one of the
following forms:
'phone_number:baud_rate,data_bits,parity,
stop_bits[*]' or
destination_name[*].
HandShake makes a decision about which
form is being used, based on the first
character. if it is a numeric digit. If
it is, it is assumed to be a phone_number
string. If it is non-numeric, it is
assumed to be a destination string.
Note that the optional
trailing '*' forces auto-redial.
Following are some correct dial strings:
'123-4567:2400,8,n,1'
'1-(555)-555-5555:1200,8,e,1*'
"Fred's BBS"
'BIX'
'John my brother'
'555-5555:1200,7,e BIX*'
The parameters after the phone number are
optional, but they must be specified in
the order if present. A destination_name
is the name of an entry in the dialing
directory.
For a more complete description of dial
strings,see the file HandShake.doc.
r = HS_GETSTR(str1,str2,..) This function waits for one of the
specified strings to arrive on the serial port. The first match will
cause the funtion to return the string that was matched. If
HS_GETLENGTH is set to a non-zero value, that number of additional
characters will be returned with the matched string. HS_GETSTR will
wait for a match for the number of seconds specified by the
HS_TIMEOUT command (see above). Upon completion, it will return
either the matched string plus the next HS_GETLENGTH characters, or
'HSERR_TIMEOUT' in the event of a timeout.
r = HS_LOADPARMS(file_name) Load a parameter file. This is the same
as selecting the load parameters item from the PROJECT menu. This
function will fail if there are any windows open on the HandShake
screen.
r = HS_RECEIVE(file_name) This function causes HandShake to go into
file receive mode. This file is received using the protocol selected
by the PROTOCOL command (see above). If one of the batch protocols
(Kermit or Ymodem Batch) is being used, the file name parameter is
the destination path name and must be terminated with a '/' or a ':'
if ASCII protocol is selected, this function only starts the receive.
To terminate the ASCII receive, use the ENDASCII command described
above.
r = HS_SAVEPARMS(file_name) Save current parameters to a file. This
is the same as selecting the save parameters item from the PROJECT
menu.
r = HS_STRING(char_str) This function sends the specified string
out the serial port. No carriage return is sent. A carriage return is
not automatically appended. If you wish to send a carriage return or
any other control character, it must be formatted into the string.
one way of doing this is illustrated below:
/* Assign some characters to variables.*/
cr = '0d'x
esc = '1b'x
/* Send a string without a carriage return */
r = hs_string('No carriage return')
/* Send a string with a carriage return */
r = hs_string('With carriage return'cr)
/* Send an escape sequence */
r = hs_string(esc'[0m')
The same technique could be used to define an ESCAPE character
for instance. Any Features of the AREXX language can be used to build
the string to be sent.
r = HS_TRANSMIT(file_name) This function causes HandShake to go into
file transmit mode. The file is transmitted using the protocol
selected by the protocol command (see above). If one of the batch
protocols (Kermit of Ymodem Batch) is being used, the file name
parameter can contain AmigaDOS wild card characters.
INVOKING AREXX MACROS FOR USE WITH HandShake
--------------------------------------------
There are five ways to invoke an AREXX macro for use with HandShake:
1) From a workbench CLI window.
2) From a HandShake CLI window.
3) From the RUN MACRO item in the AREXX menu.
4) From the HandShake command line.
5) From a HandShake Project icon.
The first two methods are the same as running any other AREXX macro
from the command line. In the first case just invoke the macro from
any workbench WSHELL, AmigaShell or CLI window (or anybody elses
shell for that matter.
In order to make it easier to run macros (especially those that
require parameters from the command line) HandShake lets you open a
CLI window on the HandShake screen if you have William Hawe's CONMAN
console editing/manager running on your system. This is done by
selecting the DOS window item from the AREXX window. HandShake will
first try to start a WShell ( William Hawe's wonderfull shell), Then
an AmigaShell and finally a CLI window on the HandShake screen. You
can have as many of these DOS windows open as you like. Beware that
some commands or functions sent to HandShake will not work if there
is a window open on the HandShake screen. This is because some
operations cause HandShake to close its screen (either temporarily or
permanently), and this cannot be safely done with windows open on the
screen. If the macro is run from a CLI on the workbench screen all
commands and functions sent to HandShake by AREXX will function
normally.
The third method can be used to run any AREXX macro which does not
take any command line parameters. The RUN MACRO menu item will open a
file requester. Just select the file which contains the AREXX macro
which you would like to run. All commands and functions sent from
AREXX to HandShake work when using this method.
The Fourth method allows you to have HandShake invoke an AREXX macro
as it starts up. Just specify the -m switch on the command line
followed by the macro name. For instance:
HandShake -m readbix
will invoke the READBIX.REXX macro. If a dial descriptor is included
on the command line, the dial activity will take place before the
macro is invoked.
The fifth method can be used when invoking HandShake from an icon. If
there is a Tool Types array entry in the icon of the form:
MACRO=READBIX
it will be invoked when HandShake is started. If there is also a
DIALUP= Tool Types entry, the dial activity will happen first.